<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%
	request.setAttribute("path", request.getContextPath());
%>
<script type="text/javascript">
$(function(){
	validate();
});
function validate(){

	$("#id").change(function (){
		check.codeId("id");
	});

	$("#name").change(function (){
		check.emptyCheck("name");
	});

	$("#costPrice").change(function (){
		check.floatNum("costPrice");
	});

	$("#centerPrice").change(function (){
		check.floatNum("centerPrice");
	});

	$("#netPrice").change(function (){
		check.floatNum("netPrice");
	});

	$("#customerPrice").change(function (){
		check.floatNum("customerPrice");
	});
	
	$("#repairMonth").change(function(){
		check.emptyCheck("repairMonth") && check.intNum("repairMonth");
	});

}
function validateId(){

	if(${isNew}){
		return check.codeId("id");
	}
	return true;
}
function save(){
	
	var uri = "${root}/mst/pro/part/update"
	if(check.emptyCheck("name") & check.floatNum("costPrice") & check.floatNum("centerPrice")
			& check.floatNum("netPrice") &  check.floatNum("customerPrice")
			&  (check.emptyCheck("repairMonth") && check.intNum("repairMonth")) & validateId()){
		common.ajaxSubmit(uri,"productPartForm","保存配件失败","",'common.windowClose()');
	}
	
}
</script>
<jsp:include page="../../base/master_js.jsp"></jsp:include>
<form class="form-horizontal" id="productPartForm" role="form">
	<jsp:include page="../../base/token.jsp" />
	<table class="table table-hover">
		<tr>
			<th>配件编号:</th>
			<td>
			    <c:choose>
			    	<c:when test="${isNew }">
			    		<input type="text" class="input-xlarge" name="id" id="id" maxlength="50" value="${part.id}" >
			    	</c:when>
			    	<c:otherwise>
			    		<input type="hidden" name="id" id="id" value="${part.id}" />
			    		 <span class="input-xlarge uneditable-input"><c:out value="${part.id}"></c:out></span>
			    	</c:otherwise>
			    </c:choose>
			</td>
			<th>配件名称:</th>
			<td> <input type="text" class="input-xlarge" name="name" id="name" maxlength="100" value="${part.name}"  ></td>
		</tr>
		<tr>
			<th>生产类型:</th>
			<td>
  	 	 		<select id="makeType" name="makeType" class="input-xlarge" >
				    <c:forEach var="item" items="${makeTypes}">
						<option value="${item.id }"><c:out value="${item.name }"/></option>
					</c:forEach>
				</select>
			</td>
			<th>配件级别:</th>
			<td>
  	 	 		<select id="level" name="level" class="input-xlarge" >
				    <c:forEach var="item" items="${partLevels}">
						<option value="${item.id }"><c:out value="${item.name }"/></option>
					</c:forEach>
				</select>
			</td>
		</tr>
		<tr>
			<th>成本价格:</th>
			<td>
				<input type="text" class="input-xlarge" name="costPrice" id="costPrice" maxlength="7" value="${part.costPrice}"  >
			</td>
			<th>中心价格:</th>
			<td>
				<input type="text" class="input-xlarge" name="centerPrice" id="centerPrice" maxlength="7" value="${part.centerPrice}"  >
			</td>
		</tr>
		<tr>
			<th>网店价格:</th>
			<td>
				<input type="text" class="input-xlarge" name="netPrice" id="netPrice" maxlength="7" value="${part.netPrice}"  >
			</td>
			<th>用户价格:</th>
			<td>
				 <input type="text" class="input-xlarge" name="customerPrice" id="customerPrice" maxlength="7" value="${part.customerPrice}"  >
			</td>
		</tr>
		<tr>
			<th>是否带序列号:</th>
			<td>
				<select id="isSerial" name="isSerial" class="input-xlarge" >
					<option value="1">是</option>
					<option value="0">否</option>
				</select>
			</td>
			<th>是否自购:</th>
			<td>
		    	<select id="isBack" name="isBack" class="input-xlarge" >
					<option value="1">是</option>
					<option value="0">否</option>
				</select>
			</td>
		</tr>
		<tr>
			<th>是否停用:</th>
			<td>
		    	<select id="isOver" name="isOver" class="input-xlarge" >
					<option value="1">是</option>
					<option value="0">否</option>
				</select>
			</td>
			<th>是否回收:</th>
			<td>
		    	<select id="isBuy" name="isBuy" class="input-xlarge" >
					<option value="1">是</option>
					<option value="0">否</option>
				</select>
			</td>
		</tr>
		<tr>
			<th>是否关联:</th>
			<td>
		    	<select id="isRelative" name="isRelative" class="input-xlarge" >
					<option value="1">是</option>
					<option value="0">否</option>
				</select>
			</td>
			<th>保修期限:</th>
			<td><input type="text" class="input-xlarge" name="repairMonth" id="repairMonth" maxlength="5" value="${part.repairMonth}"  ></td>
		</tr>
		<tr>
			<th>关键字:</th>
			<td colspan="3"><input type="text" class="input-xxlarge" name="keyword" id="keyword" maxlength="100" value="${part.keyword}"  ></td>
		</tr>
		<tr>
			<th>备注:</th>
			<td colspan="3"><input type="text" class="input-xxlarge" name="comments" id="comments" maxlength="100" value="${part.comments}"  ></td>
		</tr>
		<tr>
			<th>创建人:</th>
			<td><span class="input-xlarge uneditable-input"><c:out value="${product.createUser}"></c:out></span></td>
			<th>创建时间:</th>
			<td><span class="input-xlarge uneditable-input"><fmt:formatDate value="${product.createTime}" pattern="yyyy-MM-dd hh:mm"/></span></td>
		</tr>
		<tr>
			<th>更新人:</th>
			<td><span class="input-xlarge uneditable-input"><c:out value="${product.updateUser}"></c:out></span></td>
			<th>更新时间:</th>
			<td><span class="input-xlarge uneditable-input"><fmt:formatDate value="${product.updateTime }" pattern="yyyy-MM-dd hh:mm"/></span></td>
		</tr>
	</table>
	<div class="form-actions text-center">
      <button type="button" class="btn btn-success" onclick="save()">保存</button>
      <button type="button" class="btn btn-default" onclick="common.windowClose()">关闭</button>
	</div>
</form>
